package com.ciko.code.utils;

/**
 * @Description 固定电话判断类
 * @Author zhangdong
 * @Date 2015年7月2日上午09:05:55
 */
public class LandlineTelephoneUtil
{
	
	public static boolean isLandlineTelephone(String phone) {
		
		String[] regex = new String[16];
		regex[0] = "(010)?([2,3,5,6,8][0-9]{6,7})";									//北京010
		regex[1] = "(02[0-5,7-9])?([2,3,5,6,8][0-9]{6,7})";						//没有026（为台湾预留）
		regex[2] = "(03[1,5,7][0-9])?([2,3,5,6,8][0-9]{6,7})";						//河北0310-0319  河南0370-0379 山西0350-0359
		regex[3] = "(04[1,7][0-9])?([2,3,5,6,8][0-9]{6,7})";					//辽宁0410-0419 内蒙古0470-0479
		regex[4] = "(04[3,5][1-9])?([2,3,5,6,8][0-9]{6,7})";					//吉林0431-0439 黑龙江0451-0459
		regex[5] = "(05[1,3,5,7][0-9])?([2,3,5,6,8][0-9]{6,7})";					//江苏0510-0519 山东0530-0539 安徽0550-0559 浙江0570-0579
		regex[6] = "(059[1-9])?([2,3,5,6,8][0-9]{6,7})";							//福建0591-0599
		regex[7] = "(07[1,3,5,7,9][0-9])?([2,3,5,6,8][0-9]{6,7})";				//湖北0710-0719  湖南0730-0739 广东0750-0759 广西0770-0779 江西0790-0799
		regex[8] = "(081[2,3,6,7,8])?([2,3,5,6,8][0-9]{6,7})";						//四川0812-0813 0816-0818
		regex[9] = "(08[3,7][0-9])?([2,3,5,6,8][0-9]{6,7})";						//四川0830-0839 云南0870-0879
		regex[10] = "(085[1-9])?([2,3,5,6,8][0-9]{6,7})";							//贵州0851-0859
		regex[11] = "(089[1-8])?([2,3,5,6,8][0-9]{6,7})";							//西藏0891-0897 海南0898
		regex[12] = "(091[0-7,9])?([2,3,5,6,8][0-9]{6,7})";						//陕西0910-0919 没有0918
		regex[13] = "(09[3,9][0-9])?([2,3,5,6,8][0-9]{6,7})";					//甘肃0930-0939 新疆0990-0999
		regex[14] = "(095[1-5])?([2,3,5,6,8][0-9]{6,7})";						//宁夏0951-0955
		regex[15] = "(097[0-6,9])?([2,3,5,6,8][0-9]{6,7})";						//青海0970-0979 没有0977、0978
		
		for (int i = 0; i < regex.length; i++)
        {
	        if (phone.matches(regex[i])) {
	        	return true;
	        }
        }
		return false;
		
	}
}
